package com.ruitu.mall_98_seller.mvp.model;

import com.ruitu.arad.api.BaseResult;
import com.ruitu.arad.api.PageModel;
import com.ruitu.arad.api.RxUtil;
import com.ruitu.arad.base.BaseModel;
import com.ruitu.mall_98_seller.dao.bean.Book;
import com.ruitu.mall_98_seller.dao.http.APIRetrofit;

import io.reactivex.Observable;

public class BookModel {

    // 预订单列表
    public static class BookListM extends BaseModel {
        public Observable<BaseResult<PageModel<Book>>> reqBookList(String comId, int size, int page, String status) {
            return APIRetrofit.getDefault()
                    .reqBookList(comId, size, page, status)
                    .compose(RxUtil.<BaseResult<PageModel<Book>>>subIoObMain());
        }
    }

    // 预订单详情
    public static class BookDetailM extends BaseModel {
        public Observable<BaseResult<Book>> reqBookDetail(String bookId) {
            return APIRetrofit.getDefault()
                    .reqBookDetail(bookId)
                    .compose(RxUtil.<BaseResult<Book>>subIoObMain());
        }
    }

    // 预订单审核
    public static class BookApproveM extends BaseModel {
        public Observable<BaseResult> reqDenyBook(String id) {
            return APIRetrofit.getDefault()
                    .reqDenyBook(id)
                    .compose(RxUtil.<BaseResult>subIoObMain());
        }

        public Observable<BaseResult> reqAgreeBook(String id, String preRatio, String sendTime, String proPrice) {
            return APIRetrofit.getDefault()
                    .reqAgreeBook(id, preRatio, sendTime, proPrice)
                    .compose(RxUtil.<BaseResult>subIoObMain());
        }
    }
}
